import QtQuick 2.0
import QtQuick.Controls 1.3
import QtMultimedia 5.4
import QtQuick.Controls.Styles 1.3
import QtQuick.Window 2.0
Rectangle
{
    id:kPlayer
    width:  Screen.width/3
    height: protectionPopUp.height
    color:app.getSystemThemeColor()
    property  int index :0
    property  var index_array : new Array(0);

    APPCloseMenu{
        id:close
        anchors.top: parent.top
        anchors.topMargin: 16
        width: 20
        height: 20
        anchors.right: parent.right
        anchors.rightMargin: 16
        onClose:{
            videoImageItem.visible = false
            protectionPopUp.u_check = false
        }
    }
    Text{
        id: title
        width: parent.width
        height: 30
        color: "#FFFFFF"
        font.pixelSize: 26
        anchors.top: parent.top
        anchors.topMargin: 20
                //horizontalAlignment : Text.AlignHCenter
		 anchors.left: parent.left
		 anchors.leftMargin:8
        font.family: "黑体"
    }

    Rectangle{
        id: separator
        width: parent.width
        height: 1
        color: "#FFF"
        anchors.top: title.bottom
    }

    Rectangle{
        id:imageDisplay;
//        anchors.fill: parent
        color:"transparent"
        width: parent.width
        height: parent.height-20
        anchors.top: separator.bottom
        anchors.topMargin: 10
//        anchors.verticalCenter: parent.verticalCenter
//        color: "black"
        Image
        {
            id:img;
            width:parent.width;
            height:parent.height;
            anchors.centerIn: parent;
//            fillMode: Image.PreserveAspectFit;
            source: index_array[index]
//            MouseArea
//            {
//                anchors.fill: parent
//                onWheel: {
//                    if (wheel.modifiers & Qt.ControlModifier) {
//                        img.rotation += wheel.angleDelta.y / 120 * 5;
//                        if (Math.abs(img.rotation) < 4)
//                            img.rotation = 0;
//                    } else {
//                        img.rotation += wheel.angleDelta.x / 120;
//                        if (Math.abs(img.rotation) < 0.6)
//                            img.rotation = 0;
//                        var scaleBefore = img.scale;
//                        img.scale += img.scale * wheel.angleDelta.y / 120 / 10;
//                        img.x -= img.width * (img.scale - scaleBefore) / 2.0;
//                        img.y -= img.height * (img.scale - scaleBefore) / 2.0;
//                    }
//                }

//            }

        }
    }

    Rectangle
    {     //下一张
        id:nextPicture;
        width:40
        height: parent.height
//        anchors.left: imageDisplay.right
        anchors.right: parent.right;
        anchors.bottom:parent.bottom;
//        text:qsTr("下一张")
//        color: "red"
        color:"transparent"
        Image {
            id: name
            source: "./切图/箭头/向下.png"// This is available in all editors.
           anchors.centerIn: parent
           width: parent.width
           height: 40
            MouseArea
            {
                anchors.fill: parent
                onClicked:
                {
                    index++;
                    if(index >=index_array.length-1)
                    {
                        index = index_array.length-1
                    }
                    img.source = index_array[index]
                }
            }
        }

    }

    Rectangle
    {     //上一张
        id:previousPicture
        width:40
        height: parent.height
        anchors.left: parent.left
        anchors.bottom:parent.bottom
//        anchors.right: imageDisplay.left
//        text:qsTr("上一张")
        color:"transparent"
//        color: "red"


        Image {
            id: name01
            source: "./切图/箭头/向上.png"// This is available in all editors.
           anchors.centerIn: parent
           width: parent.width
           height: 40
            MouseArea
            {
                anchors.fill: parent
                onClicked:
                {
                    index--;
                    if(index <=0)
                    {
                        index = 0
                    }
                    img.source = index_array[index]
                }
            }
        }

    }

    function setUrl(url,name)
    {
        index_array = url;
        title.text = name
        index = 0
        img.source = index_array[index];
    }
}
